<?php
namespace App\Repositories\Admin;

use App\Models\Admin\UserImgTmpModel;
use App\Repositories\BaseRepository;

class UserImgTmpRepository extends BaseRepository
{
    protected $repository;

    public function __construct()
    {
        $this->repository = new UserImgTmpModel();
    }

    public function setAdd($data)
    {
        $data['created_at'] = time();
        return $this->repository->insertGetId($data);
    }

    public function setModify($id)
    {
        return $this->repository->where('id',$id)
            ->update(array('del'=>1));
    }

    public function setDelByUrl($url)
    {
        return $this->repository->where('url',$url)
            ->update(array(
                'del' => 1,
            ));
    }

    public function getShowOneByUrl($url){
        return $this->repository->where('url',$url)->first();
    }
}